/*
 * SceneParser.h
 *
 *  Created on: 2010-09-18
 *      Author: michal
 */

#ifndef SCENEPARSER_H_
#define SCENEPARSER_H_

#include <map>
#include <string>

#include "Scene.h"

#define PARSER_BUFFER_LENGTH      256

#define MULTI_LINE_COMMENT_START  "/*"
#define MULTI_LINE_COMMENT_END    "*/"
#define SINGLE_LINE_COMMENT       "//"

using namespace std;

class SceneParser
{
public:
	SceneParser(){ _parsedScreenWidth = _parsedScreenHeight = 256; _parsedShowProgress = false; };
	~SceneParser(){};

	Scene * ParseFromFile(const char * filename);

	int GetParsedWidth() { return _parsedScreenWidth; }
	int GetParsedHeight() { return _parsedScreenHeight; }
	bool GetParsedShowProgressOption() { return _parsedShowProgress; }

private:
	Scene * _scene;
	FILE * _file;
	char _buffer[PARSER_BUFFER_LENGTH];

	int _parsedScreenWidth;
	int _parsedScreenHeight;

	bool _parsedShowProgress;

	map<string, Material*> _materialMap;

	void ParseMultilineComment();

	void ParseGeneral();
	void ParseLight();
	void ParseMaterial();

	void ParseSphere();
	void ParsePlane();
	void ParseMetaballGroup();
};

#endif /* SCENEPARSER_H_ */
